package com.qf.fmall.utils;

import com.qf.fmall.user.entity.User;

import java.util.HashMap;

/**
 * 用来封装接口返回的数据
 */
public class ResultVo extends HashMap {
    /**
     * 返回成功的Json
     * @param code
     * @param msg
     * @param data
     * @return
     */
    public static ResultVo ok(int code, String msg, Object data) {
        ResultVo resultVo = new ResultVo();
        resultVo.put("code",code);
        resultVo.put("msg",msg);
        resultVo.put("data",data);

        return resultVo;
    }
    public static ResultVo ok(int code, String msg) {
        ResultVo resultVo = new ResultVo();
        resultVo.put("code",code);
        resultVo.put("msg",msg);
        return resultVo;
    }

    public static ResultVo notok(int code, String msg) {
        ResultVo resultVo = new ResultVo();
        resultVo.put("code",code);
        resultVo.put("msg",msg);

        return resultVo;
    }
    public static ResultVo notok(int code, String msg,Object data) {
        ResultVo resultVo = new ResultVo();
        resultVo.put("code",code);
        resultVo.put("msg",msg);
        resultVo.put("data",data);

        return resultVo;
    }
}
